package com.study.service.impl;

import com.study.dao.TeleMapper;
import com.study.pojo.entity.Departmentinfo;
import com.study.pojo.resp.ResultMessage;
import com.study.service.TeleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 通讯录业务数据接口实现类
 * @author Screncea
 */
@Service
public class TeleServiceImpl implements TeleService {
    @Autowired
    TeleMapper teleMapper;
    /**
     * 查询所有部门以及部门下员工的信息
     * @return 部门 实体类
     */
    @Override
    public ResultMessage findAllDepartment() {
        List<Departmentinfo> allDepartment = teleMapper.findAllDepartment();
        if (allDepartment!=null||allDepartment.size()>0){
            return  new ResultMessage(1,"success",allDepartment,allDepartment.stream().count());
        }
        return null;
    }
}
